package it.csi.finregio.finreges.client.printers;

import it.csi.finregio.finreges.util.SchedaData;

import java.io.InputStream;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.io.IOUtils;

public class HtmlPrinter implements Printer {

	public InputStream print(Object data) throws Exception {
		Collection dataToPrin = (Collection) data;
		StringBuffer sb = new StringBuffer();
		for (Iterator iterator = dataToPrin.iterator(); iterator.hasNext();) {
			SchedaData d = (SchedaData) iterator.next();
			sb.append(d.toString());
		}
		InputStream in = IOUtils.toInputStream(sb.toString());
		return in;
	}

}
